<?php

/**
 * Contract form base class.
 *
 * @package    form
 * @subpackage contract
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseContractForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'project_id'         => new sfWidgetFormDoctrineSelect(array('model' => 'Project', 'add_empty' => false)),
      'category'           => new sfWidgetFormChoice(array('choices' => array('Materials' => 'Materials', 'Labor' => 'Labor', 'Equipment' => 'Equipment'))),
      'contractor'         => new sfWidgetFormInput(),
      'date'               => new sfWidgetFormDate(),
      'bid_amount'         => new sfWidgetFormInput(),
      'total_release'      => new sfWidgetFormInput(),
      'total_disbursement' => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorDoctrineChoice(array('model' => 'Contract', 'column' => 'id', 'required' => false)),
      'project_id'         => new sfValidatorDoctrineChoice(array('model' => 'Project')),
      'category'           => new sfValidatorChoice(array('choices' => array('Materials' => 'Materials', 'Labor' => 'Labor', 'Equipment' => 'Equipment'))),
      'contractor'         => new sfValidatorString(array('max_length' => 50)),
      'date'               => new sfValidatorDate(array('required' => false)),
      'bid_amount'         => new sfValidatorNumber(array('required' => false)),
      'total_release'      => new sfValidatorNumber(array('required' => false)),
      'total_disbursement' => new sfValidatorNumber(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('contract[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Contract';
  }

}